package com.vic.test.designpattern._1factorypattern.easyfactorypattern;

public class SimplePizzaFactory {
    /**
     * 根据传入的type参数，返回相应的pizza
     * @param type
     * @return
     */
    public Pizza createPizza(String type) {  //一般这个方法为static
        Pizza pizza = null;

        if (type.equals("cheese")) {
            pizza = new CheesePizza();
        } else if (type.equals("pepperoni")) {
            pizza = new PepperoniPizza();
        } else if (type.equals("clam")) {
            pizza = new ClamPizza();
        } else if (type.equals("veggie")) {
            pizza = new VeggiePizza();
        }
        return pizza;
    }

}
